package cn.edu.anan.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * 用户controller
 *
 * @author ThinkPad
 * @version 1.0
 * @date 2021/7/31 21:03
 */
@RestController
@RequestMapping("user")
@Slf4j
public class UserController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("buy")
    public String buy(){
        log.info("用户准备下单购买商品.");
        String result = restTemplate.getForObject("http://provider-nacos/order/create",
                String.class);

        return result;
    }
}
